package com.probiz.estore.imports.handler.order;

import org.apache.log4j.Logger;

import com.probiz.estore.common.model.order.OrderShipment;
import com.probiz.estore.imports.handler.PersistenceHandler;
import com.probiz.estore.imports.model.ImportModel;
import com.probiz.estore.order.service.OrderShipmentManager;
import com.probiz.estore.order.service.SalesOrderManager;

public class ShipmentTrackNoPersistenceHandlerImpl implements PersistenceHandler{
	private Logger logger=Logger.getLogger(ShipmentTrackNoPersistenceHandlerImpl.class);
	private SalesOrderManager salesOrderManager;
	private OrderShipmentManager orderShipmentManager;
	
	
	
	public void setSalesOrderManager(SalesOrderManager salesOrderManager) {
		this.salesOrderManager = salesOrderManager;
	}

	
	public void setOrderShipmentManager(OrderShipmentManager orderShipmentManager) {
		this.orderShipmentManager = orderShipmentManager;
	}


	@SuppressWarnings("unchecked")
	public void saveOrUpdate(ImportModel importModel) {
		if(logger.isInfoEnabled()){
			logger.info("导入物流跟踪号");
		}
		OrderShipment  orderShipment=(OrderShipment)importModel.getTarget();
		orderShipmentManager.save(orderShipment);
		
		importModel.setResult(ImportModel.RESULT_SUCCESS); 
	}
	
	public void validate(ImportModel importModel) {
		
	}
}
